#ifndef LweSAMPLES_H
#define LweSAMPLES_H

///@file
///@brief This file contains the declaration of lwesamples structures

#include "tfhe_core.h"

struct LweSample {
	Torus32* a; //-- the n coefs of the mask
    Torus32 b;  //
   	double current_variance; //-- average noise of the sample

#ifdef __cplusplus
   LweSample(const LweParams* params);
   ~LweSample();
   LweSample(const LweSample&)=delete;
   LweSample& operator=(const LweSample&)=delete;
#endif
};


//-----------------------------------------------------------------
// autogenerated allocators/constructors/destructors declarations
// use code_autogen.pl LweSample LweParams to regenerate
//-----------------------------------------------------------------


/** allocate space for a single LweSample */
EXPORT LweSample* alloc_LweSample();
/** allocate space for an array of LweSample 
 * @param nbelts the number of elements */
EXPORT LweSample* alloc_LweSample_array(int32_t nbelts);

/** free memory space for a single LweSample 
 * @param ptr the pointer to release */
EXPORT void free_LweSample(LweSample* ptr);
/** free memory space for an array of LweSample 
 * @param nbelts the number of elements 
 * @param ptr the pointer to release */
EXPORT void free_LweSample_array(int32_t nbelts, LweSample* ptr);

/** initializes (constructor) a single LweSample on an already allocated space 
 * @param ptr the pointer to the first element
 * @param params the LWE parameters to use
 */
EXPORT void init_LweSample(LweSample* ptr, const LweParams* params);

/** initializes (constructor) an array of LweSamples on an already allocated space 
 * @param nbelts the number of elements to initialize 
 * @param ptr the pointer to the first element
 * @param params the LWE parameters to use
 */
EXPORT void init_LweSample_array(int32_t nbelts, LweSample* ptr, const LweParams* params);

/** finalizes (destructor) a single LweSample (before freeing the memory space) 
 * @param ptr the pointer to the first element
 */
EXPORT void destroy_LweSample(LweSample* ptr);

/** finalizes (destructor) an array of LweSamples (before freeing the memory space) 
 * @param nbelts the number of elements to initialize 
 * @param ptr the pointer to the first element
 */
EXPORT void destroy_LweSample_array(int32_t nbelts, LweSample* ptr);
 
/** allocates and initializes (constructor) a single LweSample 
 * @param params the LWE parameters to use
 */
EXPORT LweSample* new_LweSample(const LweParams* params);
/** allocates and initializes (constructor) a single LweSample 
 * @param nbelts the number of consecutive elements to create 
 * @param params the LWE parameters to use
 */
EXPORT LweSample* new_LweSample_array(int32_t nbelts, const LweParams* params);

/** destroy and frees memory space for a single LweSample 
 * @param ptr the pointer to release */
EXPORT void delete_LweSample(LweSample* obj);
/** destroys and free memory space for an array of LweSample 
 * @param nbelts the number of elements 
 * @param ptr the pointer to release */
EXPORT void delete_LweSample_array(int32_t nbelts, LweSample* obj);

#endif //LWESAMPLES_H

